<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>标签</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.10/semantic.min.css">
    <link rel="stylesheet" href="../static/css/me.css"> <!--引入自定义CSS样式-->
</head>
<body>
    <!--导航-->
    <nav th:replace="_fragments :: menu(3)" class="ui inverted attached segment me-padded-tb-mini me-shadow-small"> <!--引入css样式-->
        <
    </nav>

    <!--中间内容-->
    <div class="me-container-small me-padded-tb-large">
        <div class="container">
            <!--头部-->
            <div class="ui top attached stackable segment"><!--attached和下面的segment相连-->
                <div class="ui two column grid middle aligned"><!--指定两行的网格，垂直方向居中-->
                    <div class="column">
                        <h3 class="ui teal header">标签</h3>
                    </div>
                    <div class="column right aligned">
                        共 <h2 class="ui orange header me-inline-block me-text-thin" th:text="${#arrays.length(tags)}"> 14 </h2> 个 <!--h为块，自动换行，需要自己写样式-->
                    </div>
                </div>
            </div>
            <!--分类标签区域-->
            <div class="ui attached teal segment">
                <a href="#" th:each="tag: ${tags}" th:href="@{/tags/{id}(id=${tag.id})}" th:classappend="${tag.id==activeTagId} ? teal"
                   class="ui large left pointing basic label me-margin-tb-tiny"><!--margin定义外部间隔-->
                    <span class="me-text-thin" th:text="${tag.name}">方法论</span><div class="me-text-thin detail" th:text="${tag.publishedBlogs}">22</div>
                </a>
            </div>

            <div class="ui top attached teal segment">
                <div class="ui me-padded-huge me-padded-tb-medium vertical segment" th:each="blog: ${page.content}"><!--padded上下边距，vertical两个之间加横线-->
                    <div class="ui middle aligned grid stackable mobile reversed">
                        <div class="eleven wide column">
                            <a href="#" th:href="@{/blog/{id}(id=${blog.id})}">
                                <span>
                                    <h3 th:text="${blog.title}" class="ui header">你真的理解什么是财富自由嘛</h3>
                                    <p class="me-text me-black" th:text="${blog.description}"><!--字符串连接-->
                                    </p> <!--段落内容-->
                                </span>
                            </a>
                            <p>&nbsp</p>
                            <div class="ui grid">
                                <div class="sixteen wide column">
                                    <div class="ui mini horizontal link list">
                                        <div class="item"><!--图标？？-->
                                            <img th:src="@{${blog.user.avatar}}" alt="" class="ui avatar image"><!--avatar, 小图片-->
                                            <div class="content">
                                                <a href="#" class="header" th:text="${blog.user.nickname}">泽宝宝</a>
                                            </div>
                                        </div>
                                        <div class="item">
                                            <i class="calendar icon"></i><span th:text="${#dates.format(blog.updateTime, 'yyyy-MM-dd')}">2020-05-24</span>
                                        </div>
                                        <div class="item">
                                            <i class="eye icon"></i><span th:text="${blog.views}">2342</span>
                                        </div>
                                        <!--第二行放标签-->
                                        <div class="item" th:each="tag: ${blog.tags}">
                                            <a href="#" th:href="@{/tags/{id}(id=${tag.id})}" th:classappend="${tag.id==activeTagId} ? teal" class="ui me-padded-tb-tiny me-text-thin basic left pointing label"
                                                th:text="${tag.name}">方法论</a>
                                        </div>
                                    </div>
                                </div>
                                <!--第二行放标签-->
                                <!--<div class="row">
                                    <div class="column"> &lt;!&ndash;一列 充满整个宽度，不会太靠左&ndash;&gt;
                                        <a href="#" th:href="@{/tags/{id}(id=${tag.id})}" th:classappend="${tag.id==activeTagId} ? teal" class="ui me-padded-tb-tiny me-text-thin basic left pointing label"
                                        th:each="tag: ${blog.tags}" th:text="${tag.name}">方法论</a>
                                    </div>
                                </div>-->
                            </div>
                        </div>
                        <div class="five wide column">
                            <a href="#" th:href="@{/blog/{id}(id=${blog.id})}" target="_blank">
                                <img th:src="@{${blog.firstPicture}}" alt="" class="ui rounded image">
                            </a>
                        </div>
                    </div>
                </div>
            </div>

            <!--底部-->
            <div class="ui bottom attached segment" th:if="${page.totalPages}>1">
                <div class="ui two column grid">
                    <div class="column">
                        <a href="#" class="ui teal basic button" th:href="@{/(page=${page.number}-1)}" th:unless="${page.first}">上一页</a><!--basic -->
                    </div>
                    <div class="column right aligned">
                        <a href="#" class="ui teal basic button" th:href="@{/(page=${page.number}+1)}" th:unless="${page.last}">下一页</a><!--basic -->
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!--底部footer-->
    <footer th:replace="_fragments :: footer" class="ui inverted vertical segment me-padded-tb-max"><!--vertical消除圆角，用attached好像也行-->

    </footer>
    <th:block th:replace="_fragments :: script"></th:block>

    <script>
        $('.menu.toggle').click(function () {
            $('.m-item').toggleClass('me-mobile-hide');/*toggleClass，取反函数*/
        });

        //要加后面的""里的地址
        $('#newBlog-container').load(/*[[@{/footer/newBlogs}]]*/"/footer/newBlogs");
    </script>
</body>
</html>